home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / include / devices / inputevent.h < prev    next >
C/C++ Source or Header  |  1996-09-10  |  11KB  |  341 lines

  1. #ifndef DEVICES_INPUTEVENT_H
  2. #define DEVICES_INPUTEVENT_H 1
  3. /*
  4. ** inputevent.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/03/95
  11. **
  12. **
  13. */
  14.  
  15. /*
  16. ** This are the StructPointer defines for inputevent.h
  17. */
  18. #ifndef IENewTabletPtr
  19. #define IENewTabletPtr ADDRESS
  20. #endif
  21. #ifndef IEPointerPixelPtr
  22. #define IEPointerPixelPtr ADDRESS
  23. #endif
  24. #ifndef IEPointerTabletPtr
  25. #define IEPointerTabletPtr ADDRESS
  26. #endif
  27. #ifndef InputEventPtr
  28. #define InputEventPtr ADDRESS
  29. #endif
  30. #ifndef ie_dead_StructPtr
  31. #define ie_dead_StructPtr ADDRESS
  32. #endif
  33. #ifndef ie_xy_StructPtr
  34. #define ie_xy_StructPtr ADDRESS
  35. #endif
  36. #ifndef iepi_Range_StructPtr
  37. #define iepi_Range_StructPtr ADDRESS
  38. #endif
  39. #ifndef iepp_Position_StructPtr
  40. #define iepp_Position_StructPtr ADDRESS
  41. #endif
  42. #ifndef iept_Value_StructPtr
  43. #define iept_Value_StructPtr ADDRESS
  44. #endif
  45. /*
  46. ** End of StructPointer defines for inputevent.h
  47. */
  48.                    
  49. #ifndef DEVICES_TIMER_H
  50. #include <devices/TIMER.h>
  51. #endif
  52.  
  53. #ifndef UTILITY_HOOKS_H
  54. #include <utility/hooks.h>
  55. #endif
  56.  
  57. #ifndef UTILITY_TAGITEM_H
  58. #include <utility/tagitem.h>
  59. #endif
  60.  
  61. #ifndef ScreenPtr
  62. #define ScreenPtr ADDRESS
  63. #endif
  64.  
  65.  
  66. /*----- constants --------------------------------------------------*/
  67.  
  68. /*  --- InputEvent.ie_Class --- */
  69. /* A NOP input event */
  70. #define IECLASS_NULL            &H00
  71. /* A raw keycode from the keyboard device */
  72. #define IECLASS_RAWKEY          &H01
  73. /* The raw mouse report from the game port device */
  74. #define IECLASS_RAWMOUSE        &H02
  75. /* A private console event */
  76. #define IECLASS_EVENT           &H03
  77. /* A Pointer Position report */
  78. #define IECLASS_POINTERPOS      &H04
  79. /* A timer event */
  80. #define IECLASS_TIMER           &H06
  81. /* select button pressed down over a Gadget (address in ie_EventAddress) */
  82. #define IECLASS_GADGETDOWN      &H07
  83. /* select button released over the same Gadget (address in ie_EventAddress) */
  84. #define IECLASS_GADGETUP        &H08
  85. /* some Requester activity has taken place.  See Codes REQCLEAR and REQSET */
  86. #define IECLASS_REQUESTER       &H09
  87. /* this is a Menu Number transmission (Menu number is in ie_Code) */
  88. #define IECLASS_MENULIST        &H0A
  89. /* User has selected the active Window's Close Gadget */
  90. #define IECLASS_CLOSEWINDOW     &H0B
  91. /* this Window has a new size */
  92. #define IECLASS_SIZEWINDOW      &H0C
  93. /* the Window pointed to by ie_EventAddress needs to be refreshed */
  94. #define IECLASS_REFRESHWINDOW       &H0D
  95. /* new preferences are available */
  96. #define IECLASS_NEWPREFS        &H0E
  97. /* the disk has been removed */
  98. #define IECLASS_DISKREMOVED     &H0F
  99. /* the disk has been inserted */
  100. #define IECLASS_DISKINSERTED        &H10
  101. /* the window is about to be been made active */
  102. #define IECLASS_ACTIVEWINDOW        &H11
  103. /* the window is about to be made inactive */
  104. #define IECLASS_INACTIVEWINDOW      &H12
  105. /* extended-function pointer position report (V36) */
  106. #define IECLASS_NEWPOINTERPOS       &H13
  107. /* Help key report during Menu session (V36) */
  108. #define IECLASS_MENUHELP        &H14
  109. /* the Window has been modified with move,  size,  zoom,  or change (V36) */
  110. #define IECLASS_CHANGEWINDOW        &H15
  111.  
  112. /* the last class */
  113. #define IECLASS_MAX         &H15
  114.  
  115.  
  116. /*  --- InputEvent.ie_SubClass --- */
  117. /*  IECLASS_NEWPOINTERPOS */
  118. /*  like IECLASS_POINTERPOS */
  119. #define IESUBCLASS_COMPATIBLE   &H00
  120. /*  ie_EventAddress points to STRUCT IEPointerPixel */
  121. #define IESUBCLASS_PIXEL    &H01
  122. /*  ie_EventAddress points to STRUCT IEPointerTablet */
  123. #define IESUBCLASS_TABLET   &H02
  124. /*  ie_EventAddress points to STRUCT IENewTablet */
  125. #define IESUBCLASS_NEWTABLET       &H03
  126.  
  127. /* pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS, 
  128.  * and IESUBCLASS_PIXEL.
  129.  *
  130.  * You specify a screen and pixel coordinates in that screen
  131.  * at which you'd like the mouse to be positioned.
  132.  * Intuition will try to oblige,  but there will be restrictions
  133.  * to positioning the pointer over offscreen pixels.
  134.  *
  135.  * IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL.
  136.  */
  137.  
  138. STRUCT iepp_Position_Struct                  /* pixel coordinates in iepp_Screen */
  139.     SHORTINT    X 
  140.     SHORTINT    Y 
  141. END STRUCT 
  142.  
  143. STRUCT IEPointerPixel    
  144.     ScreenPtr  iepp_Screen    /* pointer to an open screen */
  145.     iepp_Position_Struct iepp_Position   /* pixel coordinates in iepp_Screen */
  146. END STRUCT 
  147.  
  148. /* pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS, 
  149.  * and IESUBCLASS_TABLET.
  150.  *
  151.  * You specify a range of values and a value within the range
  152.  * independently for each of X and Y (the minimum value of
  153.  * the ranges is always normalized to 0).
  154.  *
  155.  * Intuition will position the mouse proportionally within its
  156.  * natural mouse position rectangle limits.
  157.  *
  158.  * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET.
  159.  */
  160.  
  161. STRUCT iepi_Range_Struct  
  162.     SHORTINT  X 
  163.     SHORTINT  Y 
  164. END STRUCT
  165.  
  166. STRUCT iept_Value_Struct  
  167.     SHORTINT  X 
  168.     SHORTINT  Y 
  169. END STRUCT
  170.  
  171. STRUCT IEPointerTablet   
  172.     iepi_Range_Struct iepi_Range 
  173.  
  174.     iept_Value_Struct iept_Value
  175.  
  176.     SHORTINT        iept_Pressure   /* -128 to 127 (unused,  set to 0)  */
  177. END STRUCT 
  178.  
  179.  
  180. /* The ie_EventAddress of an IECLASS_NEWPOINTERPOS event of subclass
  181.  * IESUBCLASS_NEWTABLET points at an IENewTablet structure.
  182.  *
  183.  *
  184.  * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_NEWTABLET.
  185.  */
  186.  
  187. STRUCT IENewTablet
  188.  
  189.     /* Pointer to a hook you wish to be called back through,  in
  190.      * order to handle scaling.  You will be provided with the
  191.      * width and height you are expected to scale your tablet
  192.      * to,  perhaps based on some user preferences.
  193.      * If NULL,  the tablet's specified range will be mapped directly
  194.      * to that width and height for you,  and you will not be
  195.      * called back.
  196.      */
  197.     HookPtr  ient_CallBack 
  198.  
  199.     /* Post-scaling coordinates and fractional coordinates.
  200.      * DO NOT FILL THESE IN AT THE TIME THE EVENT IS WRITTEN!
  201.      * Your driver will be called back and provided information
  202.      * about the width and height of the area to scale the
  203.      * tablet into.  It should scale the tablet coordinates
  204.      * (perhaps based on some preferences controlling aspect
  205.      * ratio,  etc.) and place the scaled result into these
  206.      * fields.  The ient_ScaledX and ient_ScaledY fields are
  207.      * in screen-pixel resolution,  but the origin ( [0, 0]-point )
  208.      * is not defined.  The ient_ScaledXFraction and
  209.      * ient_ScaledYFraction fields represent sub-pixel position
  210.      * information,  and should be scaled to fill a SHORTINT fraction.
  211.      */
  212.     SHORTINT ient_ScaledX 
  213.     SHORTINT   ient_ScaledY 
  214.     SHORTINT ient_ScaledXFraction 
  215.     SHORTINT   ient_ScaledYFraction 
  216.  
  217.     /* Current tablet coordinates along each axis: */
  218.     LONGINT ient_TabletX 
  219.     LONGINT   ient_TabletY 
  220.  
  221.     /* Tablet range along each axis.  For example,  if ient_TabletX
  222.      * can take values 0-999,  ient_RangeX should be 1000.
  223.      */
  224.     LONGINT ient_RangeX 
  225.     LONGINT   ient_RangeY 
  226.  
  227.     /* Pointer to tag-list of additional tablet attributes.
  228.      * See <intuition/intuition.h> for the tag values.
  229.      */
  230.     TagItemPtr  ient_TagList 
  231. END STRUCT 
  232.  
  233.  
  234. /*  --- InputEvent.ie_Code --- */
  235. /*  IECLASS_RAWKEY */
  236. #define IECODE_UP_PREFIX        &H80
  237. #define IECODE_KEY_CODE_FIRST       &H00
  238. #define IECODE_KEY_CODE_LAST        &H77
  239. #define IECODE_COMM_CODE_FIRST      &H78
  240. #define IECODE_COMM_CODE_LAST       &H7F
  241.  
  242. /*  IECLASS_ANSI */
  243. #define IECODE_C0_FIRST         &H00
  244. #define IECODE_C0_LAST          &H1F
  245. #define IECODE_ASCII_FIRST      &H20
  246. #define IECODE_ASCII_LAST       &H7E
  247. #define IECODE_ASCII_DEL        &H7F
  248. #define IECODE_C1_FIRST         &H80
  249. #define IECODE_C1_LAST          &H9F
  250. #define IECODE_LATIN1_FIRST     &HA0
  251. #define IECODE_LATIN1_LAST      &HFF
  252.  
  253. /*  IECLASS_RAWMOUSE */
  254. #define IECODE_LBUTTON          &H68    /* also uses IECODE_UP_PREFIX */
  255. #define IECODE_RBUTTON          &H69
  256. #define IECODE_MBUTTON          &H6A
  257. #define IECODE_NOBUTTON         &HFF
  258.  
  259. /*  IECLASS_EVENT (V36) */
  260. #define IECODE_NEWACTIVE        &H01    /* new active input window */
  261. #define IECODE_NEWSIZE          &H02    /* resize of window */
  262. #define IECODE_REFRESH          &H03    /* refresh of window */
  263.  
  264. /*  IECLASS_REQUESTER */
  265. /*  broadcast when the first Requester (not subsequent ones) opens up in */
  266. /*  the Window */
  267. #define IECODE_REQSET           &H01
  268. /*  broadcast when the last Requester clears out of the Window */
  269. #define IECODE_REQCLEAR         &H00
  270.  
  271.  
  272.  
  273. /*  --- InputEvent.ie_Qualifier --- */
  274. #define IEQUALIFIER_LSHIFT      &H0001
  275. #define IEQUALIFIER_RSHIFT      &H0002
  276. #define IEQUALIFIER_CAPSLOCK        &H0004
  277. #define IEQUALIFIER_CONTROL     &H0008
  278. #define IEQUALIFIER_LALT        &H0010
  279. #define IEQUALIFIER_RALT        &H0020
  280. #define IEQUALIFIER_LCOMMAND        &H0040
  281. #define IEQUALIFIER_RCOMMAND        &H0080
  282. #define IEQUALIFIER_NUMERICPAD      &H0100
  283. #define IEQUALIFIER_REPEAT      &H0200
  284. #define IEQUALIFIER_INTERRUPT       &H0400
  285. #define IEQUALIFIER_MULTIBROADCAST  &H0800
  286. #define IEQUALIFIER_MIDBUTTON       &H1000
  287. #define IEQUALIFIER_RBUTTON     &H2000
  288. #define IEQUALIFIER_LEFTBUTTON      &H4000
  289. #define IEQUALIFIER_RELATIVEMOUSE   &H8000
  290.  
  291. #define IEQUALIFIERB_LSHIFT     0
  292. #define IEQUALIFIERB_RSHIFT     1
  293. #define IEQUALIFIERB_CAPSLOCK       2
  294. #define IEQUALIFIERB_CONTROL        3
  295. #define IEQUALIFIERB_LALT       4
  296. #define IEQUALIFIERB_RALT       5
  297. #define IEQUALIFIERB_LCOMMAND       6
  298. #define IEQUALIFIERB_RCOMMAND       7
  299. #define IEQUALIFIERB_NUMERICPAD     8
  300. #define IEQUALIFIERB_REPEAT     9
  301. #define IEQUALIFIERB_INTERRUPT      10
  302. #define IEQUALIFIERB_MULTIBROADCAST 11
  303. #define IEQUALIFIERB_MIDBUTTON      12
  304. #define IEQUALIFIERB_RBUTTON        13
  305. #define IEQUALIFIERB_LEFTBUTTON     14
  306. #define IEQUALIFIERB_RELATIVEMOUSE  15
  307.  
  308. /*----- InputEvent -------------------------------------------------*/
  309.  
  310. STRUCT ie_xy_Struct  
  311.     SHORTINT    ie_x        /* the pointer position for the event*/
  312.     SHORTINT    ie_y 
  313. END STRUCT 
  314.  
  315. STRUCT ie_dead_Struct  
  316.     BYTE    ie_prev1DownCode    /* previous down keys for dead */
  317.     BYTE    ie_prev1DownQual    /*   key translation: the ie_Code */
  318.     BYTE    ie_prev2DownCode    /*   & low byte of ie_Qualifier for */
  319.     BYTE    ie_prev2DownQual    /*   last & second last down keys */
  320. END STRUCT 
  321.  
  322. STRUCT InputEvent  
  323.     InputEventPtr  ie_NextEvent    /* the chronologically next event */
  324.     BYTE    ie_Class            /* the input event class */
  325.     BYTE    ie_SubClass         /* optional subclass of the class */
  326.     SHORTINT   ie_Code             /* the input event code */
  327.     SHORTINT   ie_Qualifier        /* qualifiers in effect for the event*/
  328.     ADDRESS    ie_addr_xy 
  329.     timeval ie_TimeStamp     /* the system tick at the event */
  330. END STRUCT 
  331.  
  332. #define ie_X            ie_position.ie_xy.ie_x
  333. #define ie_Y            ie_position.ie_xy.ie_y
  334. #define ie_EventAddress     ie_position.ie_addr
  335. #define ie_Prev1DownCode    ie_position.ie_dead.ie_prev1DownCode
  336. #define ie_Prev1DownQual    ie_position.ie_dead.ie_prev1DownQual
  337. #define ie_Prev2DownCode    ie_position.ie_dead.ie_prev2DownCode
  338. #define ie_Prev2DownQual    ie_position.ie_dead.ie_prev2DownQual
  339.  
  340. #endif  /* DEVICES_INPUTEVENT_H */
  341.